package com.lenin.metro.shared;

import java.io.Serializable;

import javax.persistence.Id;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Parent;

public class Tile implements Serializable {

	@Id
	String id;
	
	@Parent
	Key<TileGroup> tileGroup;
	
	public Tile() {
		
	}
	
	public Tile(Key<TileGroup> tileGroup, MapCoordinates coordinates) {
		this.tileGroup = tileGroup;
		this.id = coordinates.getLatitude()+","+coordinates.getLongitude();
	}

	public MapCoordinates getCoordinates() {
		
		String[] latLngStr = id.split(",");
		
		return new MapCoordinates(Long.parseLong(latLngStr[0]), Long.parseLong(latLngStr[1]));
	
	}
	
	
	
}
